// TrinhNX 12/18: Check code
// Cai nay anh xin nhan sai :v,tai vi khi goi ham ko dung :v 
// Goi testFinal nhung yeu cau la testFinal(final String a, String b)
// Khong co parameter :v thi lam sao ma chay duoc :3
// Chu yeu cai nay la de kiem tra final keywords
// Final keywords - co nghia la may ko nen chinh sua tao, tuy nhien doi
// voi object thi van chinh sua binh thuong :v ;v
public class TestJavaKnowledge() {

	public static void main() {
	
		TestJavaKnowledge mTest = new TestJavaKnowledge(); // Khai bao the nay co dung khong?
		// Khai bao dung
		System.out.println(mTest.testFinal()) ; // neu dung thi cau lenh nay ntn?
		//object mTest goi ham testFinal() đe thuc hien. Ket qua in ra "hello world" => Noooo.
		System.out.println(mTest.testFinalObject()) ; // neu dung thi cau lenh nay ntn?
		//object mTest goi ham testFinalObject() de thuc hien.
		//k in ra gi vi String b chua dc set.
	}

	private String testFinal(final String a, String b) {
		// trinhNX 12/18: Luu y thang a la final String
		a = "hello world"; // Sai cho nay, khong khoi tao lai duoc :/
		b = a;
		return b;
	}
	
	private String testFinalObject(final DummyObject object, String b) {
		object.setName(b);
		return object.getName();
	}
	/*
		Trong 3 class nay, cai nao dung, cai nao sai?
		Luu y cac keywords
	*/
	// class 1
	private class DummyObject{//dung
		String name = "";
		DummyObject() {
			name = "NA";
		}
		public void setName(String name) {
			this.name = name;
		}
		public String getName() {return this.name;}
	}
	
	private class DummyObject2{
		final String name; // test final
		DummyObject() {//sai. vi method nay chi co thang cha moi goi dc, do no dc khai bao trong class1
			name = "NA";
		}
		public void setName(String name) {
			this.name = name;
		}
		public String getName() {return this.name;}
	}
	
	
	private class DummyObject3{
		final static String name; // test static
		DummyObject() {//sai. vi method nay chi co thang cha moi goi dc, do no dc khai bao trong class1
			name = "NA";
		}
		public void setName(String name) {
			this.name = name;
		}
		public String getName() {return this.name;}
	}
}